package com.hkts.management.shippercomment.service.serviceimpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hkts.management.shippercomment.entity.ShipperComment;
import com.hkts.management.shippercomment.mapper.ShipperCommentMapper;
import com.hkts.management.shippercomment.service.IShipperCommentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author hml
 * @since 2021-05-20
 */
@Service
@Transactional
public class ShipperCommentServiceImpl extends ServiceImpl<ShipperCommentMapper, ShipperComment> implements IShipperCommentService {


    @Autowired
    private ShipperCommentMapper shipperCommentMapper;

    @Override
    public IPage<ShipperComment> selectPage(Page<ShipperComment> page, ShipperComment shipperComment) {
        QueryWrapper<ShipperComment> query = Wrappers.query();
        QueryWrapper<ShipperComment> entityWrapper = getEntityWrapper(query, shipperComment);
        return shipperCommentMapper.selectPage(page, entityWrapper);
    }


    @Override
    public List<ShipperComment> selectList(ShipperComment shipperComment) {
        QueryWrapper<ShipperComment> query = Wrappers.query();
        QueryWrapper<ShipperComment> entityWrapper = getEntityWrapper(query, shipperComment);
        return shipperCommentMapper.selectList(entityWrapper);
    }

    /**
     * 公共查询条件
     *
     * @param entityWrapper
     * @return
     */
    public QueryWrapper<ShipperComment> getEntityWrapper(QueryWrapper<ShipperComment> entityWrapper, ShipperComment shipperComment) {

        return entityWrapper;
    }
}
